package jdk8.function.interfaceX;

/**
 * 函数式接口作为参数
 **/
public class Demo03Runnable {
    public static void startThread(Runnable runnable) {
        new Thread(runnable).start();
    }

    public static void main(String[] args) {
        startThread(new Runnable() {
            @Override
            public void run() {
                System.out.println("线程启动了");
            }
        });

        // Lambda
        startThread(() -> System.out.println("线程启动了"));
    }
}
